package com.hczx.caxa.controller;

import com.hczx.caxa.service.MinioService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "文件服务器相关接口")
@RestController
public class MinioController {

    private final MinioService minioService;

    public MinioController(MinioService minioService) {
        this.minioService = minioService;
    }

    @ApiOperation(value = "上传至minio")
    @PostMapping("/upload")
    public void upload(@RequestPart("file") MultipartFile file) {
        minioService.upload(file, file.getOriginalFilename(), file.getContentType());
    }


}